#Include "Protheus.ch"

User Function CadCliente()

Local aStruSA1 := SA1->(dbStruct())
Local aDados   := {}
Local cCliente := "000844"
Local cLoja    := "01"
Local nMax     := Len(aStruSA1)
Local nI       := 0

dbSelectArea("SA1")
SA1->(dbSetOrder(1))
SA1->(dbSeek(xFilial("SA1") + cCliente + cLoja))

For nI := 1 To nMax
	IF "A1_FILIAL" $ RTrim(aStruSA1[nI, 1])
		AAdd(aDados, {"A1_FILIAL", "04", Nil})
	Else
		AAdd(aDados, {aStruSA1[nI, 1], SA1->&(aStruSA1[nI, 1]), Nil})
	EndIF
Next nI

Return Nil

// ----------------------------------------------------------------------------------- //